package com.iking.toolkit.system.dao;

import com.github.pagehelper.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.iking.toolkit.system.model.http.HttpDictionaryItemSelectReq;
import com.iking.toolkit.system.model.model.DictionaryItems;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * dictionary_items（数据字典内容） Mapper 接口
 *
 * @author user
 * @since 2022-10-09
 */
@Mapper
public interface DictionaryItemsMapper extends BaseMapper<DictionaryItems> {

    int deleteByPrimaryKey(String fId);

    int insertSelective(DictionaryItems record);

    DictionaryItems selectByPrimaryKey(String fId);

    int updateByPrimaryKeySelective(DictionaryItems record);

    int updateByPrimaryKey(DictionaryItems record);

    /**
     * @Description: 根据类型查询内容
     * @Param: [req]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:13
     */
    Page<DictionaryItems> searchInstrumentsId(@Param("req") HttpDictionaryItemSelectReq req);

    /**
     * @Description: 删除
     * @Param: [id]
     * @return: java.lang.Integer
     * @Author: wk
     * @Date: 7/2/2020 上午9:14
     */
    Integer deleteId(String id);

    /**
     * @Description: 根据参数查询数据
     * @Param: [pym]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:15
     */
    List<DictionaryItems> searchInstrumentsPym(String pym);

    /**
     * @Description: 防止重复(添加 ， pym)
     * @Param: [dictionaryItems]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:15
     */
    List<DictionaryItems> searchByPymInsert(DictionaryItems dictionaryItems);

    /**
     * @Description: 防止重复(添加 ， name)
     * @Param: [dictionaryItems]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:16
     */
    List<DictionaryItems> searchByNameInsert(DictionaryItems dictionaryItems);

    /**
     * @Description: 防止重复(修改 ， pym)
     * @Param: [dictionaryItems]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:17
     */
    List<DictionaryItems> searchByPymUpdate(DictionaryItems dictionaryItems);

    /**
     * @Description: 防止重复(修改 ， name)
     * @Param: [dictionaryItems]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:17
     */
    List<DictionaryItems> searchByNameUpdate(DictionaryItems dictionaryItems);

    /**
     * @Description: 查询排序最大值
     * @Param: []
     * @return: java.lang.Integer
     * @Author: wk
     * @Date: 7/2/2020 上午9:18
     */
    Integer MaxSort();

    /**
     * @Description: 根据字典类型pym(eg : CLZT)和参数value查询数据是否存在
     * @Param: [pym, value]
     * @return: com.iking.member.system.model.TDictionaryItems
     * @Author: wk
     * @Date: 7/2/2020 上午9:19
     */
    DictionaryItems selectExist(@Param("pym") String pym, @Param("value") String value);

    /**
     * @Description: 根据数据字典类型拼音码和数据字典内容拼音码查询数据字典内容
     * @Param: [valuepym, typepym]
     * @return: com.iking.member.system.model.TDictionaryItems
     * @Author: wk
     * @Date: 7/2/2020 上午9:19
     */
    DictionaryItems selectByTypeIdAndPym(@Param("valuepym") String valuepym, @Param("typepym") String typepym);

    /**
     * @Description: 根据数据字典typeId 查询所有item的名字集合
     * @Param: [typeId]
     * @return: java.util.List<java.lang.String>
     * @Author: wk
     * @Date: 7/2/2020 上午9:21
     */
    List<String> selectItemNamesByTypeId(@Param("typeId") String typeId);

    /**
     * @Description: 根据数据字典typeId 查询所有item的集合
     * @Param: [typeId]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:22
     */
    List<DictionaryItems> selectByTypeId(@Param("typeId") String typeId);

    /**
     * @Description: 根据拼音码查找字典项
     * @Param: [pym]
     * @return: com.iking.member.system.model.TDictionaryItems
     * @Author: wk
     * @Date: 7/2/2020 上午9:22
     */
    DictionaryItems selectBypym(@Param("pym") String pym);

    /**
     * @Description: 根据数据字典类型pym和数据字典内容查询内容信息
     * @Param: [typepym, count]
     * @return: com.iking.member.system.model.TDictionaryItems
     * @Author: wk
     * @Date: 7/2/2020 上午9:23
     */
    DictionaryItems selectByTypeAndItemCount(@Param("typepym") String typepym, @Param("count") String count);

    /**
     * @Description: 根据数据字典类型拼音码查询数据字典内容
     * @Param: [typepym]
     * @return: java.util.List<com.iking.member.system.model.TDictionaryItems>
     * @Author: wk
     * @Date: 7/2/2020 上午9:24
     */
    List<DictionaryItems> selectByTypePym(String typepym);

    /**
     * 批量添加数据字典内容信息
     *
     * @param dictionaryItemsList
     * @return
     */
    int insertBatch(List<DictionaryItems> dictionaryItemsList);
}
